package cn.sdormitory.controller;

import cn.sdormitory.common.api.CommonResult;
import cn.sdormitory.service.AppDormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/app/Dorm")
@Api("APP端宿舍相关数据接口")
public class AppDormController {

    @Autowired
    AppDormService appDormService;

    @ApiOperation("findAttenceList => APP端查询宿舍考勤数据列表")
    @PostMapping("/findAttenceList")
    public CommonResult findAttenceList(@RequestBody Map<String,Object> queryParam){
        return CommonResult.success(appDormService.findAttenceList(queryParam));
    }

    @ApiOperation("findAttencedByStuNo => APP端根据学号查询考勤")
    @GetMapping("/findAttencedByStuNo/{stuNo}")
    public CommonResult findAttencedByStuNo(@PathVariable String stuNo){
        return CommonResult.success(appDormService.findAttencedByStuNo(stuNo));
    }

    @ApiOperation("findHygieneList => APP端查询宿舍卫生列表")
    @PostMapping("/findHygieneList")
    public CommonResult findHygieneList(@RequestBody Map<String,Object> queryParam){
        return CommonResult.success(appDormService.findHygieneList(queryParam));
    }

    @ApiOperation("findHygieneByStuNo => APP端根据学号查询个人卫生")
    @GetMapping("/findHygieneByStuNo/{stuNo}")
    public CommonResult findHygieneByStuNo(@PathVariable String stuNo){
        return CommonResult.success(appDormService.findHygieneByStuNo(stuNo));
    }

    @ApiOperation("findRepairList => APP端查询宿舍报修数据列表")
    @PostMapping("/findRepairList")
    public CommonResult findRepairList(@RequestBody Map<String,Object> queryParam){
        return CommonResult.success(appDormService.findRepairList(queryParam));
    }


    @ApiOperation("findDormBuilding => APP端查询宿舍楼栋")
    @GetMapping("/findDormBuilding")
    public CommonResult findDormBuilding(){
        return CommonResult.success(appDormService.findDormBuilding());
    }

    @ApiOperation("findDormStorey => APP端查询宿舍楼层")
    @GetMapping("/findDormStorey")
    public CommonResult findDormStorey(){
        return CommonResult.success(appDormService.findDormStorey());
    }

    @ApiOperation("findDorm => APP端查询宿舍号")
    @PostMapping("/findDorm")
    public CommonResult findDorm(@RequestBody Map<String,Object> param){
        return CommonResult.success(appDormService.findDorm(param));
    }
}
